package com.danbay.cloud.project.api.service;

import com.danbay.cloud.project.api.dto.*;
import com.danbay.framework.db.pagination.PageParam;
import com.danbay.framework.db.pagination.PageResult;
import com.danbay.framework.exception.BusinessException;
import com.danbay.framework.springnc.annotation.AutoController;
import com.danbay.framework.springnc.annotation.RequestMapping;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;
import java.util.Map;

/**
 * @author SJG
 *         2018/1/29.
 */

@AutoController
@RequestMapping("/project-service/house")
@Api("房源操作接口")
public interface IHouseService {

    /**
     * 添加房源
     *
     * @param house 房源信息
     * @throws BusinessException 业务异常
     */
    @ApiOperation(value = "添加房源", notes = "注意：房源ID格式为：44030501(省+市+区县+房源序号)")
    @RequestMapping(value = "/add", method = RequestMethod.POST)
    void add(@RequestBody HouseDto house) throws BusinessException;

    /**
     * 修改房源
     *
     * @param house 房源信息
     * @throws BusinessException 业务异常
     */
    @ApiOperation(value = "修改房源")
    @RequestMapping(value = "/edit", method = RequestMethod.POST)
    void edit(@RequestBody HouseDto house) throws BusinessException;

    /**
     * 删除房源
     *
     * @param hid 房源ID
     * @throws BusinessException 业务异常
     */
    @ApiOperation(value = "删除房源")
    @RequestMapping(value = "/del", method = RequestMethod.POST)
    void del(@ApiParam("房源ID") @RequestParam("hid") String hid) throws BusinessException;

    /**
     * 分页查询房源信息
     *
     * @param param 查询参数
     * @return 房源列表
     */
    @ApiOperation(value = "分页查询房源信息")
    @RequestMapping(value = "/findHouses", method = RequestMethod.POST)
    PageResult<HouseInfoDto> findHouses(@RequestBody PageParam<HouseQueryDto> param);

    /**
     * 通过房源id列表批量取房源信息
     *
     * @param houseIds 房源id列表
     * @return 房源信息列表
     */
    @ApiOperation(value = "通过房源id列表批量取房源信息")
    @RequestMapping(value = "/getHouses", method = RequestMethod.POST)
    List<HouseInfoDto> getHouses(@RequestBody List<String> houseIds);

    /**
     * 使用magicId查询房源名列表
     *
     * @param magicId 房源id前面部分
     * @return 房源名列表
     */
    @ApiOperation(value = "使用magicId查询房源名列表")
    @RequestMapping(value = "/findHouseNames", method = RequestMethod.GET)
    List<HouseNameDto> findHouseNames(@ApiParam("房源id前面部分") @RequestParam("magicId") String magicId);

    /**
     * 使用房源id取得该房源所有楼层列表
     *
     * @param houseId 房源id
     * @return 楼层列表
     */
    @ApiOperation(value = "使用房源id取得该房源所有楼层列表")
    @RequestMapping(value = "/getHouseFloors", method = RequestMethod.GET)
    List<String> getHouseFloors(@ApiParam("房源id") @RequestParam("houseId") String houseId);

    /**
     * 添加房间
     *
     * @param room 房间信息
     * @throws BusinessException 业务异常
     */
    @ApiOperation(value = "添加房间")
    @RequestMapping(value = "/addRoom", method = RequestMethod.POST)
    void addRoom(@RequestBody RoomDto room) throws BusinessException;

    /**
     * 修改房间
     *
     * @param room 房间信息
     * @throws BusinessException 业务异常
     */
    @ApiOperation(value = "房间信息")
    @RequestMapping(value = "/editRoom", method = RequestMethod.POST)
    void editRoom(@RequestBody RoomDto room) throws BusinessException;

    /**
     * 删除房间
     *
     * @param rid 房间id
     * @throws BusinessException 业务异常
     */
    @ApiOperation(value = "删除房间")
    @RequestMapping(value = "/delRoom", method = RequestMethod.POST)
    void delRoom(@ApiParam("房间ID") @RequestParam("rid") String rid) throws BusinessException;

    /**
     * 分页查询房间信息
     *
     * @param param 查询参数
     * @return 房间列表
     */
    @ApiOperation(value = "分页查询房间信息")
    @RequestMapping(value = "/findRoom", method = RequestMethod.POST)
    PageResult<RoomDto> findRoom(@RequestBody PageParam<RoomQueryDto> param);
}
